﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<TPOJ.Web.ViewModel.StatisticsRecord>>" %>
<%@ Import Namespace ="TPOJ.Core" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Contest Statistics
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <h2>Contest Statistics -- <%= ViewData["contestTitle"] %></h2>

    <table>
        <tr>
            <th>
                
            </th>
            <th>
                AC
            </th>
            <th>
                PE
            </th>
            <th>
                WA
            </th>
            <th>
                TLE
            </th>
            <th>
                MLE
            </th>
            <th>
                RE
            </th>
            <th>
                OLE
            </th>
            <th>
                CE
            </th>
            <th>
                Others
            </th>
            <th>
                Total
            </th>
        </tr>
    <% int i = -1; %>
    <% foreach (var item in Model) { %>
    <% i++; %>
        <tr>
            
            <td>
                <%=  Html.ActionLink(Convert.ToChar('A' + i).ToString(), "Details", "Problem", new { id = item.ProblemId }, new { target = "_blank" })%>
            </td>
            <td>
                <%= Html.Encode(item.ResultsCount[(byte)ResultType.Accepted]) %>
            </td>
            <td>
                <%= Html.Encode(item.ResultsCount[(byte)ResultType.RepresentationError]) %>
            </td>
            <td>
                <%= Html.Encode(item.ResultsCount[(byte)ResultType.WrongAnswer]) %>
            </td>
            <td>
                <%= Html.Encode(item.ResultsCount[(byte)ResultType.TimeLimitExceeded]) %>
            </td>
            <td>
                <%= Html.Encode(item.ResultsCount[(byte)ResultType.MemoryLimitExceeded]) %>
            </td>
            <td>
                <%= Html.Encode(item.ResultsCount[(byte)ResultType.RuntimeError]) %>
            </td>
            <td>
                <%= Html.Encode(item.ResultsCount[(byte)ResultType.OutputLimitExceeded]) %>
            </td>
            <td>
                <%= Html.Encode(item.ResultsCount[(byte)ResultType.CompileError]) %>
            </td>
            <td>
                <%= Html.Encode(item.ResultsCount[(byte)ResultType.Pending]+item.ResultsCount[(byte)ResultType.RestrictedUsage]+item.ResultsCount[(byte)ResultType.SystemError]) %>
            </td>
            <td>
                <%= Html.Encode(item.ResultsCount.Sum(r=>r.Value)) %>
            </td>
        </tr>
    
    <% } %>

    </table>
    <br />
    <table>
        <tr>
            <th>
                
            </th>
            <% foreach (var item in (IList<TPOJ.Core.Language>)Application["languages"]) { %>
            <th>
                <%= Html.Encode(item.Name) %>
            </th>
            <%} %>
        </tr>
        <% int j = -1; %>
        <% foreach (var item in Model) { %>
        <% j++; %>
        <tr>
            <td>
                <%=  Html.ActionLink(Convert.ToChar('A' + j).ToString(), "Details", "Problem", new { id = item.ProblemId }, new { target = "_blank" })%>
            </td>
            <% foreach (var lang in (IList<TPOJ.Core.Language>)Application["languages"])
               { %>
            <td>
                <%= Html.Encode(item.LanguagesCount[lang.Name])%>
            </td>
            <%} %>
        </tr>
        <%} %>
    </table>

</asp:Content>
